<%@ page language="java" %>

<%@ page import="com.scalar.chiptrack.commons.SessionKeys,
                 com.scalar.chiptrack.utils.ConfigManager,
				 com.scalar.chiptrack.commons.Constants,
				 com.scalar.chiptrack.users.Functionality,
				 com.scalar.chiptrack.users.User"%>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>
<chiptrack:checkLogon sourcePage="/assmReleaseSearch.do" />
<%String chipTracContext = "/" + ConfigManager.getChipTracContext(); %>
<HTML>
<HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel="stylesheet">
<script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/quickSearch.js"></script>

<SCRIPT language="JavaScript">
window.onload = init;

function init()
{
    qs_1 = new QuickSearch(document.assmReleaseSearchForm.processStep_Id, document.assmReleaseSearchForm.qs1, false);
    qs_2 = new QuickSearch(document.assmReleaseSearchForm.releaseNumber, document.assmReleaseSearchForm.qs2, false);
}
function printView( assmReleaseId )
{
	newWindow = window.open ('<%=chipTracContext%>/assmRelease.do?action=printerFriendly&assmReleaseId='+assmReleaseId,'printerFreindlyPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,width=800,height=550,resizable=yes');
}

/*function setAssemblyPartNumber()
{
    document.assmReleaseSearchForm.processStep_Id.value = document.assmReleaseSearchForm.fgAssmProcessstepId.value;
}

function setFGPartNumber()
{
    document.assmReleaseSearchForm.fgAssmProcessstepId.value = document.assmReleaseSearchForm.processStep_Id.value;
}*/

function reset()
{
    document.assmReleaseSearchForm.reset();
    qs_1.resetQuickSearchCntrl();
    qs_2.resetQuickSearchCntrl();
}
</SCRIPT>
</HEAD>
<BODY bgColor="#ffffff" leftMargin="0" topMargin="0" marginheight="0" marginwidth="0">
<!-- Top Header Start-->
<%@ include file="/jsp/includes/header.jsp" %>
<!-- Top Header End-->
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
	<tr>
	    <td width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>
            <!-- Side Navigation start -->
            <%@ include file="/jsp/operations/releaseMenu.jsp" %></TD>
            <!-- end of the side navigations -->
    	<td bgcolor="#ffffff"><img height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></td>
        <td bgcolor="#ffffff"><img height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></td>
	    <td valign="top" width="100%">
	        <IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
    	    <BR>
            <html:form action="/assmReleaseSearch.do?action=search" method="post" type="com.scalar.chiptrack.operations.release.forms.AssmReleaseSearchForm">
		    <TABLE width="95%" align="right" cellpadding="2" cellspacing="2" border="0">
                <tr><td colspan="4" class="NArialW" align="center">Assembly Release</td></tr>
                <tr><td colspan='4' align="left" class='NArialL'>&nbsp;<FONT id="errors" color='FF0000'></font></td></tr>
                <tr><td colspan='4' class="NArialL"><chiptrack:errors styleClass="NArialL"/></td></tr>
                <tr><td colspan='4' class="NArialL"><chiptrack:info styleClass="NArialL"/></td></tr>
                <tr><td colspan='4'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='10'></td></tr>
                <tr>
                    <td width="25%" class="NArialL">
                        Quick Search Release Number:
                    </td>
                    <td width="25%" class="NArialL">
                        <input type="text" name="qs2" class="txfield" size='21' onkeyup='quickSearch(qs_2)'/>
                    </td>
                    <td  width="25%" class="NArialL">
                        Quick Search Part Number:
                    </td>
                    <td  width="25%" class="NArialL">
                        <input type="text" name="qs1" class="txfield" size='21' onkeyup='quickSearch(qs_1)'/>
                    </td>
                </tr>
                <tr>
                    <td class="NArialL">
                        Release Number:
                    </td>
                    <td class="NArialL">
                        <html:select name="assmReleaseSearchForm" property="releaseNumber"  styleClass="txfield" style="width:150px">
                            <html:option value="-1">All</html:option>
                            <logic:present name="releaseNumbers">
                                <html:options name="releaseNumbers"/>
                            </logic:present>
                        </html:select>
                    </td>
                    <td class="NArialL">
                        FG Part Number:
                    </td>
                    <td class="NArialL">
                        <html:select name="assmReleaseSearchForm" property="processStep_Id"  styleClass="txfield" onchange="javascript:setFGPartNumber();" style="width:150px">
                            <html:option value="-1">All Part Numbers</html:option>
                            <html:options collection="partNumberList" property="value" labelProperty="label"/>
                        </html:select>
                    </td>
                </tr>
                <tr>
                    <td class="NArialL">
                        Vendor:
                    </td>
                    <td class="NArialL">
                        <html:select name="assmReleaseSearchForm" property="vendor_Id"  styleClass="txfield" style="width:150px">
                            <html:option value="-1">All Vendors</html:option>
                            <html:options collection="toLocationList" property="value" labelProperty="label"/>
                        </html:select>
                    </td>
                    <td class="NArialL">
                        Status:
                    </td>
                    <td class="NArialL">
                        <html:select name="assmReleaseSearchForm" property="searchStatus"  styleClass="txfield" style="width:150px">
                            <html:option value="-1">All</html:option>
                            <html:options collection="statusList" property="value" labelProperty="label"/>
                        </html:select>
                    </td>
                </tr>
                <tr>
                    <td class="NArialL">
                        Year:
                    </td>
                    <td class="NArialL">
                        <html:select name="assmReleaseSearchForm" property="year"  styleClass="txfield"  style="width:150px">
                            <html:option value="-1">All</html:option>
                            <html:options collection="yearList" property="value" labelProperty="label"/>
                        </html:select>
                    </td>
                    <td class="NArialL">
                        Release Type:
                    </td>
                    <td class="NArialL">
                        <html:select name="assmReleaseSearchForm" property="requestType"  styleClass="txfield" style="width:150px">
                            <html:option value="-1">All</html:option>
                            <html:options collection="requestTypes" property="value" labelProperty="label"/>
                        </html:select>
                    </td>
                </tr>
                <tr><td colspan='4'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='10'></td></tr>
                <tr>
                    <td colspan="5" align="center">
                        <input type=image border="0" src="<%=chipTracContext%>/jsp/includes/images/search.gif" width="53" height="17" onmouseover="window.status='Click to Search for Wafer Sort Release';return true" onmouseout="window.status='';return true" title="Click here to Search for Wafer Sort Release">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <a href="javascript:reset();"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/reset.gif" width="53" height="17" onmouseover="window.status='Click to Reset';return true" onmouseout="window.status='';return true" title="Click here to Reset"></a>
                    </td>
                </tr>
                <tr><td colspan='4'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='20'></td></tr>
                <tr>
                    <td colspan='4' class="NArialL">
                        Please
                        <chiptrack:restrictedLink functionality='<%=Functionality.ASSEMBLY_RELEASE %>' action='<%=User.USER_ACTION_MODIFY%>' styleClass="leftsection" href='<%=chipTracContext+"/newAssmRelease.do"%>' onmouseover="window.status='Click to Create Assembly Release';return true" onmouseout="window.status='';return true">
                            click here
                        </chiptrack:restrictedLink> to generate new Assembly Release
                    </td>
                </tr>
                <tr><td colspan='4'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='10'></td></tr>
                <logic:present name="releaseList" scope="request">
                <tr>
                    <td colspan='4' class="NArialL"><font color="#FF0000"><b>"**"</b></font> <font color="#0000FF">represents the Release Lots Partially Received to Assembly (Cancel,Close not Allowed) </font> </td>
                </tr>
                <tr><td colspan='4'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='10'></td></tr>

                <tr>
                    <td colspan='4' width="100%">
                        <table>
                            <tr>
                                <td width="14%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Assmbly Release No</font></font></td>
                                <td width="16%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Part Number</font></font></td>
                                <td width="12%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Vendor</font></font></td>
                                <td width="12%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Date</font></font></td>
                                <td width="14%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Qty Released</font></font></td>
                                <td width="12%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Type</font></font></td>
                                <td width="12%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Turn Key</font></font></td>
                                <td width="12%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Status</font></font></td>
                                <td width="20%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Action</font></font></td>
                            </tr>
                            <logic:iterate name="releaseList" type="com.scalar.chiptrack.operations.release.AssemblyRelease" id="assemblyRelease" indexId="iteratorIdx">
                            <tr <%if(iteratorIdx.intValue()%2==0){%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%>>
                                <td align="center" class="NArialL">
                                    <logic:equal name="assemblyRelease" property="partialReceived" value='true'>
                                    <font color ="#FF0000">**</font>
                                    </logic:equal>
                                    <bean:write name="assemblyRelease" property="assemblyReleaseNo" />
                                </td>
                                <td align="center" class="NArialL">
                                    <bean:write name="assemblyRelease" property="partNumber" />
                                </td>
                                <td align="center" class="NArialL">
                                    <bean:write name="assemblyRelease" property="vendorName" />
                                </td>
                                <td align="center" class="NArialL">
                                    <bean:write name="assemblyRelease" property="releaseDate" />
                                </td>
                                <td align="center" class="NArialL">
                                    <bean:write name="assemblyRelease" property="qtyPulled" />
                                </td>
                                <td align="center" class="NArialL">
                                    <bean:write name="assemblyRelease" property="requestType" />
                                </td>
                                <td align="center" class="NArialL">
                                    <bean:write name="assemblyRelease" property="turnKeyLabel" />
                                </td>
                                <td align="center" class="NArialL">
                                    <bean:write name="assemblyRelease" property="status" />
                                </td>
                                <td align="left" nowrap  class="NArialL">
                                    <a href="<%=chipTracContext%>/assmRelease.do?action=view&assmReleaseId=<bean:write name="assemblyRelease" property="assemblyReleaseId"/>" onMouseOver="window.status='Click to View Assembly Release';return true" onMouseout="window.status='';return ">View </a>
                                    &nbsp;&nbsp;
                                    <bean:define name='assemblyRelease' property='status' id="releaseStatus"/>
                                    <!-- Approved Issued-->
                                    <%
                                    if( !( Constants.RELEASE_STATUS_CANCELLED ).equalsIgnoreCase( (java.lang.String)releaseStatus ) && !( Constants.RELEASE_STATUS_CLOSED ).equalsIgnoreCase( (java.lang.String)releaseStatus ) )
                                    {
                                    %>
                                        <a href="<%=chipTracContext%>/assmRelease.do?action=edit&assmReleaseId=<bean:write name="assemblyRelease" property="assemblyReleaseId"/>" onMouseOver="window.status='Click to Modify Assembly Release';return true" onMouseout="window.status='';return ">Modify</a>
                                        &nbsp;&nbsp;
                                    <%
                                    }
                                    else
                                    {
                                    %>
                                        Modify&nbsp;&nbsp;&nbsp;
                                    <%
                                    }
                                    %>

                                    <%
                                    if( ( "Issued" ).equalsIgnoreCase( (java.lang.String)releaseStatus ) )
                                    {
                                    %>
                                        <a href="<%=chipTracContext%>/assmRelease.do?action=confirm&assmReleaseId=<bean:write name="assemblyRelease" property="assemblyReleaseId"/>" onMouseOver="window.status='Click to Approve Assembly Release';return true" onMouseout="window.status='';return ">Approve</a>
                                        &nbsp;&nbsp;
                                    <%
                                    }
                                    else
                                    {
                                    %>
                                        Approve&nbsp;&nbsp;&nbsp;
                                    <%
                                    }
                                    %>

                                    <%
                                    if( !( Constants.RELEASE_STATUS_CANCELLED ).equalsIgnoreCase( (java.lang.String)releaseStatus ) && !( Constants.CUSTOMER_SHIPPING_STATUS_SHIPPED ).equalsIgnoreCase( (java.lang.String)releaseStatus )  &&  !( Constants.RELEASE_STATUS_CLOSED ).equalsIgnoreCase( (java.lang.String)releaseStatus ))
                                    {
                                    %>
                                        <logic:equal name="assemblyRelease" property="partialReceived" value='true'>
                                         Cancel&nbsp;&nbsp;
                                        </logic:equal>
                                        <logic:notEqual name="assemblyRelease" property="partialReceived" value='true'>
                                        <a href="<%=chipTracContext%>/assmRelease.do?action=cancel&assmReleaseId=<bean:write name="assemblyRelease" property="assemblyReleaseId"/>" onMouseOver="window.status='Click to Cancel Assembly Release';return true" onMouseout="window.status='';return ">Cancel</a>&nbsp;&nbsp;
                                        </logic:notEqual>
                                    <%
                                    }
                                    else
                                    {
                                    %>
                                        Cancel&nbsp;&nbsp;
                                    <%
                                    }
                                    if( !( Constants.RELEASE_STATUS_CANCELLED ).equalsIgnoreCase( (java.lang.String)releaseStatus ) && !( Constants.CUSTOMER_SHIPPING_STATUS_SHIPPED ).equalsIgnoreCase( (java.lang.String)releaseStatus )  &&  !( Constants.RELEASE_STATUS_CLOSED ).equalsIgnoreCase( (java.lang.String)releaseStatus ))
                                    {
                                    %>  <logic:equal name="assemblyRelease" property="partialReceived" value='true'>
                                         Close&nbsp;&nbsp;
                                        </logic:equal>
                                        <logic:notEqual name="assemblyRelease" property="partialReceived" value='true'>
                                        <a href="<%=chipTracContext%>/assmRelease.do?action=close&assmReleaseId=<bean:write name="assemblyRelease" property="assemblyReleaseId"/>" onMouseOver="window.status='Click to Close Assembly Release';return true" onMouseout="window.status='';return ">Close</a>&nbsp;&nbsp;
                                        </logic:notEqual>
                                    <%
                                    }
                                    else
                                    {
                                    %>
                                        Close&nbsp;&nbsp;
                                    <%
                                    }
                                    %>
                                </td>
                            </tr>
                            </logic:iterate>
                        </table>
                    </td>
                </tr>
                </logic:present>
		    </TABLE>
	        </html:form>
            <!-- till here -->
            <BR><BR><BR>
        </td>
        <td bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></td>
    </tr>
</TABLE>
<!-- Footer starts here -->
<%@ include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->
</BODY>
</HTML>

<%--<%
    }
    catch(Exception e )
    {
        e.printStackTrace();
    }
%>--%>
